package com.example.common.model;

import lombok.Data;

import java.util.HashMap;

/**
 * @Author: hwz
 * @Date: 2018/6/25
 */
@Data
public class ResultObj {

    private int code;
    private String message;
    private HashMap<String,Object> data = new HashMap<>();

    public ResultObj() {
        this.code = ResultCode.CODE_OK.getCode();
        this.message = ResultCode.CODE_OK.getDesc();
    }

    public ResultObj(ResultCode code) {
        this.code = code.getCode();
        this.message = code.getDesc();
    }

    public ResultObj(int code, String message){
        this.code = code;
        this.message = message;
    }

    public ResultObj putData(String key, Object value){
        this.data.put(key,value);
        return this;
    }

}
